<template>
  <el-dialog title="处理" :visible.sync="dialogVisible" width="40%" class="popup" :before-close="handleClose">
    <el-form :form="form" label-width="100px">
      <el-form-item label="设备名称:">
        <el-input v-model="form.name" />
      </el-form-item>
      <el-form-item label="空间位置:">
        <el-input v-model="form.pos" />
      </el-form-item>
      <el-form-item label="报警类型:">
        <el-input v-model="form.type" />
      </el-form-item>
      <el-form-item label="报警时间:">
        <el-input v-model="form.time" />
      </el-form-item>
      <el-form-item label="处理意见:">
        <el-select v-model="form.opt">
          <el-option v-for="item in option" :key="item.label" :label="item.value" :value="item.label" />
        </el-select>
      </el-form-item>
      <el-form-item label="处理方式:">
        <el-radio v-model="form.select" label="xiaoyin">消音</el-radio>
        <el-radio v-model="form.select" label="fuwei">复位</el-radio>
      </el-form-item>
      <el-form-item label="备注:">
        <el-input v-model="form.remark" type="textarea" />
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button size="small" @click="dialogVisible = false">取消</el-button>
      <el-button type="primary" size="small" @click="dialogVisible = false">提交</el-button>
    </span>
  </el-dialog>
</template>

<script>
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
  components: {
  },
  data() {
    return {
      form: {
        name: '',
        pos: '',
        type: '',
        time: '',
        opt: '',
        select: 'xiaoyin',
        remark: ''
      },
      option: [
        {
          label: 1,
          value: '警报解除'
        },
        {
          label: 2,
          value: '误报'
        },
        {
          label: 3,
          value: '测试'
        }
      ],
      dialogVisible: false,
      ruleForm: {
        pass: '',
        checkPass: '',
        age: ''
      },

      value: null,
      // define options
      options: [{
        id: 'a',
        label: 'a',
        children: [{
          id: 'aa',
          label: 'aa'
        }, {
          id: 'ab',
          label: 'ab'
        }]
      }, {
        id: 'b',
        label: 'b'
      }, {
        id: 'c',
        label: 'c'
      }]
    }
  },
  computed: {
    rules() {
      return {
        pass: [
          { required: true, message: '请输入活动名称', trigger: 'blur' }
        ],
        checkPass: [
          { required: true, message: '请输入活动名称', trigger: 'blur' }
        ],
        age: [
          { required: true, message: '请输入活动名称', trigger: 'blur' }
        ]
      }
    }

  },
  methods: {
    togglehandle(flag) {
      this.dialogVisible = flag
    },
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done()
          this.$refs.form.resetFields()
          this.form = {
            name: '',
            pos: '',
            type: '',
            time: '',
            opt: '',
            select: '',
            remark: ''
          }
        })
        .catch(_ => { })
    },
    handleChange(e) {
      console.log('选择', e)
    }
  }
}
</script>

<style lang="scss" scoped>
.el-descriptions {
  border-bottom: 1px solid #cdd0db;
}

.popup {
  ::v-deep .el-dialog {
    border-radius: 4px;
  }
  ::v-deep .el-dialog__header {
    border-bottom: 1px solid #cdd0db;
  }
  ::v-deep .el-dialog__body {
    padding: 30px;
  }
}
</style>

